package com.gzmu.face.mapper;

import com.gzmu.face.entity.Person;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author xiaobo Yan
 * @since 2020-04-20
 */
@Mapper
public interface PersonMapper extends BaseMapper<Person> {
    @Insert("INSERT INTO t_person(DeviceID,IdType,CustomizeID,LibID,PersonUUID,PersonType,Name,Gender,Nation,CardType," +
            "IdCard,Birthday,Telnum,Native,Address,Notes,MjCardFrom,WiegandType,WGFacilityCode,MjCardNo,CardMode,RFIDCard," +
            "Tempvalid,ValidBegin,ValidEnd,ChannelAuthorityX,EffectNumber,isCheckSimilarity,IdCardId,AccessId,WardenId," +
            "RoomNum,picinfo,picURI,remark) VALUES (#{DeviceID},#{IdType},#{CustomizeID},#{LibID},#{PersonUUID},#{PersonType}," +
            "#{Name},#{Gender},#{Nation},#{CardType},#{IdCard},#{Birthday},#{Telnum},#{Native},#{Address},#{Notes},#{MjCardFrom}," +
            "#{WiegandType},#{WGFacilityCode},#{MjCardNo},#{CardMode},#{RFIDCard},#{Tempvalid},#{ValidBegin},#{ValidEnd}," +
            "#{ChannelAuthorityX},#{EffectNumber},#{isCheckSimilarity},#{IdCardId},#{AccessId},#{WardenId},#{RoomNum},#{picinfo}," +
            "#{picURI},#{remark}) ON DUPLICATE KEY UPDATE DeviceID=#{DeviceID},IdType=#{IdType},CustomizeID=#{CustomizeID}," +
            "LibID=#{LibID},PersonUUID=#{PersonUUID},PersonType=#{PersonType},Name=#{Name},Gender=#{Gender},Nation=#{Nation}," +
            "CardType=#{CardType},IdCard=#{IdCard},Birthday=#{Birthday},Telnum=#{Telnum},Native=#{Native},Address=#{Address}," +
            "Notes=#{Notes},MjCardFrom=#{MjCardFrom},WiegandType=#{WiegandType},WGFacilityCode=#{WGFacilityCode},MjCardNo=#{MjCardNo}," +
            "CardMode=#{CardMode},RFIDCard=#{RFIDCard},Tempvalid=#{Tempvalid},ValidBegin=#{ValidBegin},ChannelAuthorityX=#{ChannelAuthorityX}," +
            "EffectNumber=#{EffectNumber},isCheckSimilarity=#{isCheckSimilarity},IdCardId=#{IdCardId},AccessId=#{AccessId}," +
            "WardenId=#{WardenId},RoomNum=#{RoomNum},picinfo=#{picinfo},picURI=#{picURI},remark=#{remark}")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    Integer insertPerson(Person person);
}
